<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//后台登录页面
Route::get('admin/login','Admin\LoginController@index');
Route::post('admin/toLogin','Admin\LoginController@login');

Route::get('admin/logout','Admin\LoginController@logout');

//后台首页
Route::get('admin/index','Admin\IndexController@index')->middleware('login');

//网站设置
Route::get('admin/system','Admin\SystemController@index')->middleware('login');
Route::get('admin/system/edit','Admin\SystemController@edit')->middleware('login');
Route::post('admin/system/update','Admin\SystemController@update')->middleware('login');

//网站后台幻灯片(资源路由)
Route::resource('admin/image','Admin\ImageController')->middleware('login');
Route::post('admin/upload','Admin\ImageController@upload')->middleware('login');

//评论管理
Route::get('admin/comment','Admin\CommentController@index')->middleware('login');

//评论删除
Route::delete('admin/comment/delete/{id}','Admin\CommentController@delete')->middleware('login');

//文章管理
Route::resource('admin/article','Admin\ArticleController')->middleware('login');

//分类管理 category
Route::resource('admin/cate','Admin\CateController')->middleware('login');

//管理员密码修改
Route::match(['get' , 'post'],'admin/user/pass','Admin\UserController@pass')->middleware('login');

//用户列表
Route::get('admin/user','Admin\UserController@index')->middleware('login');
Route::post('admin/checkPass','Admin\LoginController@checkPass');

//用户冻结
Route::delete('admin/freeze/{id}','Admin\UserController@freeze')->middleware('login');

//友情链接
Route::resource('admin/link','Admin\LinkController')->middleware('login');;


//前台页面
Route::get('/','Home\IndexController@index');

//文章
// Route::get('article','Home\ArticleController@index');
Route::get('article/detail/{id}','Home\ArticleController@detail')->where('id' ,'\d+');

//文章分类
Route::get('cate/{id}','Home\CateController@index')->where('id' ,'\d+');

//文章点赞
Route::get('article/link/{id}','Home\ArticleController@link');

//文章评论
Route::post('article/comment','Home\ArticleController@comment');

//文章搜索
Route::post('article/search','Home\ArticleController@search');

//用户的登录以及注册
Route::match(['get','post'],'login','Home\UserController@login');
Route::match(['get','post'],'register','Home\UserController@register');

//注册检验用户名是否存在
Route::post('check','Home\UserController@checkName');

//用户退出
Route::get('logout','Home\UserController@logout');

